const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "自增id",
      field: "id"
    },
    order_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "订单id",
      field: "order_id"
    },
    user_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "用户id",
      field: "user_id"
    },
    address_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件地址id",
      field: "address_id"
    },
    alias: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "别名",
      field: "alias"
    },
    name: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件人-姓名",
      field: "name"
    },
    tel: {
      type: DataTypes.CHAR(15),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件人-电话",
      field: "tel"
    },
    province: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件人-省",
      field: "province"
    },
    city: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件人-市",
      field: "city"
    },
    county: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件人-县/区",
      field: "county"
    },
    address: {
      type: DataTypes.CHAR(200),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件人-详细地址",
      field: "address"
    },
    province_name: {
      type: DataTypes.CHAR(30),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件人-省-名称",
      field: "province_name"
    },
    city_name: {
      type: DataTypes.CHAR(30),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件人-市-名称",
      field: "city_name"
    },
    county_name: {
      type: DataTypes.CHAR(30),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "收件人-县/区-名称",
      field: "county_name"
    },
    lng: {
      type: DataTypes.DECIMAL,
      allowNull: false,
      defaultValue: "0.0000000000",
      primaryKey: false,
      autoIncrement: false,
      comment: "收货地址-经度",
      field: "lng"
    },
    lat: {
      type: DataTypes.DECIMAL,
      allowNull: false,
      defaultValue: "0.0000000000",
      primaryKey: false,
      autoIncrement: false,
      comment: "收货地址-纬度",
      field: "lat"
    },
    idcard_name: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "身份证姓名",
      field: "idcard_name"
    },
    idcard_number: {
      type: DataTypes.CHAR(30),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "身份证号码",
      field: "idcard_number"
    },
    idcard_front: {
      type: DataTypes.CHAR(255),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "身份证人像面图片",
      field: "idcard_front"
    },
    idcard_back: {
      type: DataTypes.CHAR(255),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "身份证国微面图片",
      field: "idcard_back"
    },
    add_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "添加时间",
      field: "add_time"
    },
    upd_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "更新时间",
      field: "upd_time"
    }
  };
  const options = {
    tableName: "sxo_order_address",
    comment: "",
    indexes: [{
      name: "order_id",
      unique: false,
      type: "BTREE",
      fields: ["order_id"]
    }, {
      name: "user_id",
      unique: false,
      type: "BTREE",
      fields: ["user_id"]
    }]
  };
  const SxoOrderAddressModel = sequelize.define("sxo_order_address_model", attributes, options);
  return SxoOrderAddressModel;
};